import { Tag } from 'ant-design-vue';
import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.EventList;
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  // {
  //   title: '事件ID',
  //   width: 80,
  //   dataIndex: 'eventId',
  // },
  {
    title: '事件名称',
    width: 320,
    dataIndex: 'eventName',
    formItemProps: {
      componentProps: {
        placeholder: '请选择事件名称',
      },
    },
  },
  {
    title: '创建时间',
    width: 280,
    dataIndex: 'eventCreateTime',
    hideInSearch: true,
  },
  {
    title: '事件类型',
    width: 80,
    dataIndex: 'eventType',
    formItemProps: {
      component: 'Select',
      componentProps: {
        placeholder: '请选择事件类型',
        options: [
          {
            label: '帮办',
            value: 0,
          },
          {
            label: '代办',
            value: 1,
          },
        ],
      },
    },
    customRender: ({ record }) => {
      const enable = ~~record.eventType === 1;
      return <Tag color={enable ? 'green' : 'blue'}>{enable ? '代办' : '帮办'}</Tag>;
    },
  },
];
